package com.cykj.user.service.impl;

import com.cykj.common.dto.ResponseDTO;
import com.cykj.common.entity.CollectionRecruitDO;
import com.cykj.user.mapper.CollectMapper;
import com.cykj.user.service.ICollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongsProject: smart_recruit_backend
 * @BelongsPackage: com.cykj.user.service.impl
 * @Author: 浮行
 * @CreateTime: 2025-08-25 19:52
 * @Description: TODO
 * @Version: 1.0
 */
@Service
public class CollectServiceImpl implements ICollectService {
    @Autowired
    private CollectMapper collectMapper;

    @Override
    public ResponseDTO selectCollectList(Integer userId) {
        List<CollectionRecruitDO> collectionRecruitDOS = collectMapper.selectCollectList(userId);
        if(collectionRecruitDOS != null){
            return ResponseDTO.success(collectionRecruitDOS);
        }
        return ResponseDTO.error();
    }

    @Override
    public ResponseDTO deleteCollect(Integer collectionId) {
        Integer res = collectMapper.deleteCollect(collectionId);
        if(res > 0){
            return ResponseDTO.success();
        }
        return ResponseDTO.error();
    }
}
